package com.ruoyi.system.service.life.impl;


import com.nlf.calendar.Lunar;
import com.nlf.calendar.Solar;
import com.ruoyi.system.domain.life.LifeGiftList;
import com.ruoyi.system.mapper.life.LifeGiftListMapper;
import com.ruoyi.system.service.life.ILifeGiftListService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import static com.ruoyi.common.utils.SecurityUtils.getUsername;


/**
 * 人情世故Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-22
 */
@Service
public class LifeGiftListServiceImpl implements ILifeGiftListService {
    @Resource
    private LifeGiftListMapper lifeGiftListMapper;

    /**
     * 查询人情世故
     *
     * @param lGiftId 人情世故主键
     * @return 人情世故
     */
    @Override
    public LifeGiftList selectLifeGiftListByLGiftId(Long lGiftId) {
        return lifeGiftListMapper.selectLifeGiftListByLGiftId(lGiftId);
    }

    /**
     * 查询人情世故列表
     *
     * @param lifeGiftList 人情世故
     * @return 人情世故
     */
    @Override
    public List<LifeGiftList> selectLifeGiftListList(LifeGiftList lifeGiftList) {
        return lifeGiftListMapper.selectLifeGiftListList(lifeGiftList);
    }

    /**
     * 新增人情世故
     *
     * @param lifeGiftList 人情世故
     * @return 结果
     */
    @Override
    public int insertLifeGiftList(LifeGiftList lifeGiftList) {
        lifeGiftList.setCreateBy(getUsername());
        lifeGiftList.setCreateTime(new Date());
        return lifeGiftListMapper.insertLifeGiftList(lifeGiftList);
    }

    /**
     * 修改人情世故
     *
     * @param lifeGiftList 人情世故
     * @return 结果
     */
    @Override
    public int updateLifeGiftList(LifeGiftList lifeGiftList) {
        lifeGiftList.setUpdateBy(getUsername());
        lifeGiftList.setUpdateTime(new Date());
        return lifeGiftListMapper.updateLifeGiftList(lifeGiftList);
    }

    /**
     * 批量删除人情世故
     *
     * @param lGiftIds 需要删除的人情世故主键
     * @return 结果
     */
    @Override
    public int deleteLifeGiftListByLGiftIds(Long[] lGiftIds) {
        return lifeGiftListMapper.deleteLifeGiftListByLGiftIds(lGiftIds);
    }

    /**
     * 删除人情世故信息
     *
     * @param lGiftId 人情世故主键
     * @return 结果
     */
    @Override
    public int deleteLifeGiftListByLGiftId(Long lGiftId) {
        return lifeGiftListMapper.deleteLifeGiftListByLGiftId(lGiftId);
    }

    @Override
    public BigDecimal getTotalMoney(LifeGiftList lifeGiftList) {
        return lifeGiftListMapper.getTotalMoney(lifeGiftList);
    }

    public static void main(String[] args) {
        Lunar lunar = Lunar.fromYmd(2022, 11, 19);
        //农历    二〇二三年冬月初八
        System.out.println(lunar);
        // 转阳历
        Solar solar = lunar.getSolar();
        //阳历 2023-12-20
        System.out.println(solar.toString());
        //2023-12-20 00:00:00 星期三 射手座
        System.out.println(solar.toFullString());

        Lunar d = Lunar.fromDate(new Date());
        System.out.println(d);
        System.out.println(d.toFullString());

        System.out.println(d.getYear());
        System.out.println(d.getMonth());
        System.out.println(d.getDay());

        System.out.println(d.getYearInChinese());
        System.out.println(d.getMonthInChinese());
        System.out.println(d.getDayInChinese());


    }
}

